package org.un.cava.birdeye.ravis.components.renderers.edgeLabels{
	import mx.controls.Button;
	import mx.core.IDataRenderer;
	import mx.effects.Move;
	
	import org.un.cava.birdeye.ravis.graphLayout.visual.IVisualEdge;
	
public class MovingEdgeLabelRender extends Button implements IDataRenderer{
	private var moveEffect:Move=new Move();
	public var diameter:Number = 8
	public function MovingEdgeLabelRender(){
		this.creationPolicy = ContainerCreationPolicy.ALL;
		super();
		this.addEventListener(FlexEvent.CREATION_COMPLETE,initComponent);
		
	}
	protected function initComponent(e:Event):void{
		var fromX:Number=(this.data as IVisualEdge).edge.node1.vnode.viewCenter.x;
		var fromY:Number=(this.data as IVisualEdge).edge.node1.vnode.viewCenter.y;
		var toX:Number=(this.data as IVisualEdge).edge.node2.vnode.viewCenter.x;
		var toY:Number=(this.data as IVisualEdge).edge.node2.vnode.viewCenter.Y;
		this.width =diameter;
 		this.height=diameter;
 		setStyle("fillAlphas", [1.0, 0.4]);
        setStyle("fillColors", ["red", "red"]);
        
        moveEffect.xFrom=fromX;
	 	moveEffect.yFrom = fromY;
	 	moveEffect.yTo = toY;
	 	moveEffect.xTo = toX;
	 	moveEffect.duration=5000;
	 	moveEffect.repeatCount = 0;	 	
	 	moveEffect.play();
		
	}

}

}